<?php

class Fileupload_deal_Controller extends Base_Controller {

    public function action_upload() {
        if (!Input::has('filename') || !Input::has('uuid')) {
            return Response::json(
                            array(
                                'errno' => UMSErrcode::PARA_ERR,
            ));
        }
        $fileName = Input::get('filename');
        $uuid = Input::get('uuid');
        $fileuploadLogic = new FileUploadLogic();
        $ret = $fileuploadLogic->insertItem($fileName, $uuid);
        unset($fileuploadLogic);
        if ($ret) {
            return Response::json(array(
                        'errno' => UMSErrcode::SUCCESS,
            ));
        } else {
            return Response::json(array(
                        'errno' => UMSErrcode::SYS_ERR,
            ));
        }
    }

    public function action_transcode() {
        if (!Input::has('uuid')) {
            return Response::json(array(
                        'errno' => UMSErrcode::PARA_ERR,
            ));
        }

        $uuid = Input::get('uuid');
        $fileuploadLogic = new FileUploadLogic();
        $ret = $fileuploadLogic->updateItem($uuid);
        unset($fileuploadLogic);
        if ($ret) {
            return Response::json(array(
                        'errno' => UMSErrcode::SUCCESS,
            ));
        } else {
            return Response::json(array(
                        'errno' => UMSErrcode::SYS_ERR,
            ));
        }
    }

}

?>
